<?php

/**
 * Tutoria form base class.
 *
 * @method Tutoria getObject() Returns the current form's model object
 *
 * @package    ecampus
 * @subpackage form
 * @author     Grupo 608
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTutoriaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_tutoria'  => new sfWidgetFormInputHidden(),
      'id_docente'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Docente'), 'add_empty' => true)),
      'id_alumno'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Alumno'), 'add_empty' => true)),
      'fecha_desde' => new sfWidgetFormDate(),
      'fecha_hasta' => new sfWidgetFormDate(),
      'activo'      => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id_tutoria'  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_tutoria')), 'empty_value' => $this->getObject()->get('id_tutoria'), 'required' => false)),
      'id_docente'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Docente'), 'required' => false)),
      'id_alumno'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Alumno'), 'required' => false)),
      'fecha_desde' => new sfValidatorDate(array('required' => false)),
      'fecha_hasta' => new sfValidatorDate(array('required' => false)),
      'activo'      => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('tutoria[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Tutoria';
  }

}
